<?php
namespace BoxEdu\Widget;
class TopicWidget extends \WidgetController
{
    function class_new(){
					   $this->subjectid=I('subjectid',"0","intval");
								$data=BoxModel("edu_subject")->where(array('subjectid'=>$this->subjectid))->find();
			     $this->subjectid=$data['parent_id']?$data['parent_id']:$this->subjectid;
					  	$where=array('pid'=>2);
        if($this->subjectid){
								 $where=array('pid2'=>$this->subjectid,'pid'=>1);	
								}
								$where['type']="classNew";
							$data=BoxModel("sns_topic")->get($where,"6");
							$this->data=$data['list'];
					  $this->display();
				}
				
				
				function widgetTopic($params){
				  $where=	$params['where'];
						$limit=	$params['limit']?$params['limit']:10;
						//dump($where);
						if(!$where){
						 return ;	
						}
						$where.=" and is_show=1 and type='eduAsk'";
						$data=BoxModel("sns_topic")->get($where,$limit,"lastupdate desc");
						$this->data=$data['list'];
						if($this->data){
						 $this->display();
						}
				}
}